package cn.zch.soft.util.thread;
import lombok.extern.slf4j.Slf4j;
/***
 * @class synchronizedLockModeTest
 * @description 测试 SynchronizedLockModeTest
 * @author zch
 * @date 2019/8/27
 * @version V0.0.1.201908271834.01
 * @ modfiyDate 201908271834
 * @ createDate 201908271834
 * @ package com.xb.utils.thread.utils.test
 */
@Slf4j
public class SynchronizedLockModeTest {
	public static void main(String[] args) {
		test();
	}
	public static void test() {
		final SynchronizedLockMode slm = new SynchronizedLockMode();
		Thread thread1 = new Thread(new Runnable() {
			@Override
			public void run() {
				slm.lockMethod();
			}
		});
		Thread thread2 = new Thread(new Runnable() {
			@Override
			public void run() {
				SynchronizedLockMode.lockStaticMethod();
			}
		});
		Thread thread3 = new Thread(new Runnable() {
			@Override
			public void run() {
				slm.lockBlock();
			}
		});
		thread1.start();
		thread2.start();
		thread3.start();
		try {
			Thread.sleep(1000);
		}
		catch (InterruptedException e) {
			log.warn(e.getMessage());
			Thread.currentThread().interrupt();
		}
	}
}
